<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>保险批单</title>
	<jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="insPlcBscInfo_form">
	<div class="fieldset1 tabel_col clearFix">
		<div class="caption">
			<span class="title">保单基本信息</span>
		</div>
		<div class="fieldBox col_50">
			<div class="label">保险种类</div>
			<div class="field">
				<input name="insTypCd" id="insTypCd" data-value="${insPlcBscInfoVO.insTypCd}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">购买方式</div>
			<div class="field">
				<input name="buyWayCd" id="buyWayCd" data-value="${insPlcBscInfoVO.buyWayCd}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.buyWayCd!=insPlcApprVo.buyWayCd}">
					<span class="requiredSymbol">${insPlcApprVo.buyWayCdNm}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保单性质</div>
			<div class="field">
				<input name="plcPropCd" id="plcPropCd" data-value="${insPlcBscInfoVO.plcPropCd}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
			</div>
			<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.plcPropCd!=insPlcApprVo.plcPropCd}">
				<span class="requiredSymbol">${insPlcApprVo.plcPropCdNm}</span>
			</c:if>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保险产品类型</div>
			<div class="field">
				<input name="prdTypCd" id="prdTypCd" data-value="${insPlcBscInfoVO.prdTypCd}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.prdTypCd!=insPlcApprVo.prdTypCd}">
					<span class="requiredSymbol">${insPlcApprVo.prdTypCdNm}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保险公司所属省份</div>
			<div class="field">
				<input name="rgnPrCd" id="rgnPrCd" data-value="${insPlcBscInfoVO.rgnPrCd}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol insplc">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.rgnPrCd!=insPlcApprVo.rgnPrCd}">
					<span class="requiredSymbol">${insPlcApprVo.rgnPrCdNm}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保险公司所属城市</div>
			<div class="field">
				<input name="rgnCyCd" id="rgnCyCd" data-value="${insPlcBscInfoVO.rgnCyCd}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol insplc">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.rgnCyCd!=insPlcApprVo.rgnCyCd}">
					<span class="requiredSymbol">${insPlcApprVo.rgnCyCdNm}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保险公司</div>
			<div class="field">
				<input name="insCompId" id="insCompId" data-value="${insPlcBscInfoVO.insCompId}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.insCompId!=insPlcApprVo.insCompId}">
					<span class="requiredSymbol">${insPlcApprVo.insCompNm}</span>
				</c:if>
			</div>
		</div>
		<div class="fieldBox col_50" id="subIdDiv"
				<c:if test="${not empty insPlcBscInfoVO.buyWayCd and insPlcBscInfoVO.buyWayCd==1}"> style="display: none;"</c:if>>
			<div class="label">保险支公司</div>
			<div class="field">
				<input name="insCompSubId" id="insCompSubId" data-value="${insPlcBscInfoVO.insCompSubId}"
					   placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.insCompSubId!=insPlcApprVo.insCompSubId}">
					<span class="requiredSymbol">${insPlcApprVo.insCompSubNm}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50" id="subNmDiv" <c:if test="${empty insPlcBscInfoVO.buyWayCd or insPlcBscInfoVO.buyWayCd!=1}"> style="display: none;"</c:if>>
			<div class="label">保险支公司</div>
			<div class="field">
				<div class="l-text" style="width: 178px;">
					<input name="insCompSubNm" id="insCompSubNm" type="text" class="ui-textbox l-text-field"
						   value="${insPlcBscInfoVO.insCompSubNm}" validate="{required:false,maxlength:200}"
						   style="width: 174px;">
				</div>
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.insCompSubNm!=insPlcApprVo.insCompSubNm}">
					<span class="requiredSymbol">${insPlcApprVo.insCompSubNm}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保单号</div>
			<div class="field">
				<input name="plcNo" id="plcNo" type="text" class="ui-textbox" value="${insPlcBscInfoVO.plcNo}"
					   validate="{required:true,maxlength:30}">
				<span class="requiredSymbol insplc">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.plcNo!=insPlcApprVo.plcNo}">
					<span class="requiredSymbol">${insPlcApprVo.plcNo}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">保费总金额</div>
			<div class="field">
				<input name="plcExpCd" id="plcExpCd" value="1" style="display: none;">
				<input name="insTtlFee" id="insTtlFee" type="text" class="ui-textbox" data-tofix="2"
					   value="${insPlcBscInfoVO.insTtlFeeDb}" ligerui="width: 178"
					   validate="{required:true,number:true}">
				<span class="requiredSymbol">*</span>
                <c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.insTtlFeeDb!=insPlcApprVo.insTtlFeeDb}">
                    <span class="requiredSymbol">${insPlcApprVo.insTtlFeeDb}</span>
                </c:if>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">起保时间</div>
			<div class="field">
				<input name="plcBgTm" id="plcBgTm" type="text" class="ui-datepicker" value="${insPlcBscInfoVO.plcBgTms}"
					   validate="{required:true}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.plcBgTm!=insPlcApprVo.plcBgTm}">
					<span class="requiredSymbol">${insPlcApprVo.plcBgTms}</span>
				</c:if>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">止保时间</div>
			<div class="field">
				<input name="plcEndTm" id="plcEndTm" type="text" class="ui-datepicker"
					   value="${insPlcBscInfoVO.plcEndTms}"
					   validate="{required:true}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.plcEndTm!=insPlcApprVo.plcEndTm}">
					<span class="requiredSymbol">${insPlcApprVo.plcEndTms}</span>
				</c:if>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">被保险人</div>
			<div class="field">
				<input name="insPerNm" id="insPerNm" type="text" class="ui-textbox" value="${insPlcBscInfoVO.insPerNm}"
					   validate="{required:false,maxlength:20}">
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.insPerNm!=insPlcApprVo.insPerNm}">
					<span class="requiredSymbol">${insPlcApprVo.insPerNm}</span>
				</c:if>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">被保险人证件号码</div>
			<div class="field">
				<input name="insPerCretNo" id="insPerCretNo" type="text" class="ui-textbox"
					   value="${insPlcBscInfoVO.insPerCretNo}" validate="{required:false,maxlength:20}">
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.insPerCretNo!=insPlcApprVo.insPerCretNo}">
					<span class="requiredSymbol">${insPlcApprVo.insPerCretNo}</span>
				</c:if>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">第一受益人</div>
			<div class="field">
				<input name="fstPer" id="fstPer" data-value="${insPlcBscInfoVO.fstPer}" value="狮桥融资租赁（中国）有限公司"
					   class="ui-textbox" validate="{maxlength:25}">
                <c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.fstPer!=insPlcApprVo.fstPer}">
                    <span class="requiredSymbol">${insPlcApprVo.fstPer}</span>
                </c:if>
			</div>
		</div>

		<div class="fieldBox col_50">
			<div class="label">批单号</div>
			<div class="field">
				<input name="apprCode" id="apprCode" type="text" class="ui-textbox"
					   value="${insPlcBscInfoVO.apprCode}" validate="{required:true,maxlength:20}">
				<span class="requiredSymbol">*</span>
				<c:if test="${not empty insPlcApprVo}">
					<span class="requiredSymbol">${insPlcApprVo.apprCode}</span>
				</c:if>
			</div>
		</div>

		<div class="fieldBox col_100">
			<div class="label">特别说明</div>
			<div class="field">
                <textarea name="plcRem" id="plcRem" class="ui-textarea l-textarea" cols="130" rows="3"
						  style="width: 97%;"
						  value="${insPlcBscInfoVO.plcRem}"
						  validate="{required:false,maxlength:200}">${insPlcBscInfoVO.plcRem}</textarea>
				<c:if test="${not empty insPlcApprVo and insPlcBscInfoVO.plcRem!=insPlcApprVo.plcRem}">
					<span class="requiredSymbol">${insPlcApprVo.plcRem}</span>
				</c:if>
			</div>
		</div>
		<%--<div class="fieldBox col_100" id="fileModify" style="display:none;">
			<div class="label">保单附件</div>
			<div class="field">
				<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecList.jsp" flush="true">
					<jsp:param name="pkId" value="${insPlcBscInfoVO.id}"/>
					<jsp:param name="tabNm" value="INS_PLC_BSC_INFO"/>
				</jsp:include>
			</div>
		</div>
		<div class="fieldBox col_100">
			<div class="label">电子保单<span class="requiredSymbol">*</span></div>
			<div class="field">
				<span class="sq-button-hasicon onlyicon" id="add_upfileBox"><i class="sqBtnIco_26"></i></span>
				<div class="upfileBoxs">
					<input type="file" id="addUp10_1" name="addUp10_1" style="display:none;"><br/>
					<input type="file" id="addUp10_2" name="addUp10_2" style="display:none;">
					<span>(请上传交强险附件 ，否则可能会影响流程进度)</span>
				</div>
			</div>--%>
		</div>
        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>保单资料</span>
                <span class="btns"><span class="sq-button sq-button-round" onclick="downloadInsFileByUrl();">打包下载</span></span>
            </div>
            <div class="sqPanel_body">
                <div id="insFileInfoCfgGrid" class="sq-grid"></div>
            </div>
        </div>
		<input type="hidden" id="filePath" value="insPlcInfo"/>
		<input type="text" style="display:none" id="paySchId" name="paySchId" value="${paySchId}">
		<input type="text" style="display:none" id="prjPrdDtlId" name="prjPrdDtlId" value="${prjPrdDtlId}">
		<input type="text" style="display:none" id="paySchNo" name="paySchNo" value="${paySchNo}">
		<input type="text" style="display:none" id="plcId" name="plcId" value="${plcId}">
		<input type="text" style="display:none" id="prjId" name="prjId" value="${prjId}">
		<input type="text" style="display:none" id="contNo" name="contNo" value="${contNo}">
		<input type="text" style="display:none" id="prjTypCd" name="prjTypCd" value="${prjTypCd}">
		<input type="text" style="display:none" id="bizTypCd" name="bizTypCd" value="${bizTypCd}">
		<%--<input type="text" style="display:none" id="rgnCd" name="rgnCd" value="${rgnCd}">--%>
		<input type="text" style="display:none" id="orgCd" name="orgCd" value="${orgCd}">
		<input type="text" style="display:none" id="plcSpePolCd" name="plcSpePolCd"
			   value="${insPlcBscInfoVO.plcSpePolCd}">
		<input type="text" style="display:none" id="chnPol" name="chnPol" value="${insPlcBscInfoVO.chnPol}">
	</div>

	<div class="btnsBox">
		<span id="saveInsPlcBscInfo_Btn" class="sq-button sq-button-round">保存</span>
		<span id="startRenewFlow_Btn" class="sq-button sq-button-round" style="display: none;">发起流程</span>
		<span id="back_Btn" class="sq-button sq-button-round">返回</span>
		<input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
	</div>

	<div class="fieldset1 tabel_col clearFix">
		<div class="caption">
			<span class="title">保单产品信息</span>
		</div>
		<div class="fieldBox col_100">
			<div id="ligergrid_insprd" class="sq-grid"></div>
		</div>
	</div>

</form>
<script type="text/javascript" src="<%=path%>/resource/lib/plugins/ajaxfileupload.js"></script>
<script>
    var plcPrdGrid, form;
    var upload_result_params = [];//初始 加 新增
    var upload_result_params_new = [];//新增
    var plcId = null, insPlcBscInfoId = null,isTrailer="";
    var insFileInfoCfgGrid = null;//保单资料配置明细
    var ctrlKey='${ctrlKey}';
    var serverPrefixPath = "";
    var checkPlcNoStr = '';
    var paySchNo = $("#paySchNo").val();

    $(function () {
        insPlcBscInfoId = "${insPlcBscInfoVO.id}";//主键ID
        plcId = $("#plcId").val();
        isTrailer="${isTrailer}";//挂车标示

        //获取服务器路径前缀
        $.ajax({
            type: 'get',
            url: '<%=path%>/system/sysulfilesrec/getServerPath.do',
            success:function(msg){
                serverPrefixPath = msg;
            }
        });

        $("#insCompSubId").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                if (this.NotFirstChange == undefined && insPlcBscInfoId) {
                    this.NotFirstChange = true;
                } else {
                    if (value && value != 'init') {
                        validateInsComp(value);
                    }
                }
                ;
            },
            autocomplete: function (e) {
                filter_autoComboboxData(e.key, this);
                e.show();
            },
        });
        $("#insCompId").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                if (this.NotFirstChange == undefined && insPlcBscInfoId) {
                    this.NotFirstChange = true;
                } else {
                    if (value && value != 'init') {
                        setInsSubComp();
                    }
                }
                ;
            },
            autocomplete: function (e) {
                filter_autoComboboxData(e.key, this);
                e.show();
            },
        });
        $("#rgnPrCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                setCity(value);
                if (this.NotFirstChange == undefined && insPlcBscInfoId) {
                    this.NotFirstChange = true;
                } else {
                    if (value) {
                        setInsSubComp();
                    }
                }
                ;
            },
            autocomplete: function (e) {
                filter_autoComboboxData(e.key, this);
                e.show();
            },
        });
        $("#rgnCyCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                if (this.NotFirstChange == undefined && insPlcBscInfoId) {
                    this.NotFirstChange = true;
                } else {
                    if (value) {
                        setInsSubComp();
                    }
                }
                ;
            },
            autocomplete: function (e) {
                filter_autoComboboxData(e.key, this);
                e.show();
            },
        });

        $("#insTypCd").ligerComboBox({//险种
            valueField: 'key',
            textField: 'value',
        });
        $("#prdTypCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
        });
        $("#buyWayCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                if (value) {
                    var buyWayCd = liger.get("buyWayCd").getValue();
                    if (buyWayCd != 1) {//非我司渠道
                        changeInsSubComp();
                    } else {//我司渠
                        form.setFieldValidate("insCompSubId", {required: true});
                        form.setFieldValidate("insCompSubNm", {required: false, maxlength: 200});
                        form.setFieldValidate("plcNo", {required: true, maxlength: 30});
                        form.setFieldValidate("rgnPrCd", {required: true});
                        form.setFieldValidate("rgnCyCd", {required: true});
                        $("#subNmDiv").hide();
                        $("#subIdDiv").show();
                        $(".insplc").show();
                        setInsSubComp();
                    }
                }
            }
        });
        //起保时间change事件
        $("#plcBgTm").ligerDateEditor({
            onChangeDate: function (value) {
                var date = new Date(value);
                date.setFullYear(date.getFullYear() + 1);
                date.setDate(date.getDate() - 1);
                liger.get("plcEndTm").setValue(date);
            }
        });
        $("#plcPropCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                if (this.NotFirstChange == undefined && insPlcBscInfoId) {
                    this.NotFirstChange = true;
                } else {
                    if (value) {
                        changeInsSubComp();
                    }
                }
            }
        });
        //验证保单号
        $("#plcNo").ligerTextBox({
            width: 178,
            onChangeValue: function (value) {
                validatePlcNo(value);
            }
        });

        form = $("#insPlcBscInfo_form").ligerForm({
            validate: true
        });
        liger.get("insTypCd").setData(${insTypCdList});
        liger.get("prdTypCd").setData(${prdTypCdList});
        liger.get("buyWayCd").setData(${buyWayCdList});
        liger.get("plcPropCd").setData(${plcPropCdList});
        liger.get("insCompId").setData(${insCompList});
        liger.get("insCompId").updateStyle();

        //显示发起流程按钮
        <c:if test="${not empty plcId}">
        <c:if test="${not empty flowFlag and flowFlag==1}">
        $('#startRenewFlow_Btn').show();
        </c:if>
        </c:if>

        //发送请求获取省级区域
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '<%=path%>/system/sysRegion/getProvinceRegion.do',
            success: function (msg) {
                if (msg.success == 1) {
                    liger.get("rgnPrCd").setData(msg.data, true);
                    liger.get("rgnPrCd").updateStyle();
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });

        if (insPlcBscInfoId) {//修改时禁用保险种类
            liger.get("insTypCd").setDisabled();
            // $("#fileModify").show();
        }

        var typList = [];//险种列表
        <c:if test="${not empty typList}">
        typList = ${typList};
        </c:if>

        //保单产品明细
        plcPrdGrid = $("#ligergrid_insprd").ligerGrid({
            url: '<%=path%>/insurance/insPlcBscInfo/initPlcPrdList.do?prjPrdDtlId=${prjPrdDtlId}',
            method: 'get',
            columns: [
                {display: '产品名称', name: 'prdNm', minWidth: 100, align: 'center'},
                {display: '产品型号', name: 'prdMdl', width: 100, align: 'left'},
                {display: '厂商', name: 'mfrNm', minWidth: 100, align: 'left'},
                {display: '供应商', name: 'splNm', minWidth: 100, align: 'left'},
                {display: '发动机编号', name: 'engMdl', width: 100, align: 'left'},
                {display: '车架号', name: 'vinNo', width: 100, align: 'left'},
                {display: '底盘号', name: 'chsNo', width: 100, align: 'left'},
                {
                    display: '单价', name: 'prdAmt', width: 90, align: 'right',
                    render: function (rowdata, rowindex, value) {
                        return '&yen;' + FormatMoney(rowdata.prdAmt / 100);
                    }
                },
                {
                    display: '合格证号', name: 'certNo', minWidth: 100, align: 'left',
                    render: function (rowdata, rowindex, value) {
                        if (value) {
                            return '<a href="javascript:;" onclick="detailBtn(' + rowdata.actPrdId + ',' + rowdata.prjPrdDtlId + ')">' + rowdata.certNo + '</a>';
                        }
                    }
                },
                {display: '客户名称', name: 'cstNm', width: 100, align: 'left'},
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            allowUnSelectRow: true,
            alternatingRow: false
        });

        //返回
        $("#back_Btn").click(function () {
            Remove_navTab();
        });

		/*保存保单*/
        $("#saveInsPlcBscInfo_Btn").click(function (event) {
        	if ($("#plcNo").val()==''){
            	$("#saveInsPlcBscInfo_Btn").removeAttr("validateplcno");
			}
            var _flag = $(this).attr("validateplcno");
            if (_flag == "fail") {
                $.ligerDialog.SQalert({content: checkPlcNoStr, SQ_type: "warning", SQ_showButtons: true,});
                return false;
            }
            var data = form.getData();
            _flag = $(this).attr("validateinscomp");
            if (_flag == "fail" && data.buyWayCd == 1) {
                $.ligerDialog.SQalert({content: "保险支公司未录入返利比例", SQ_type: "warning", SQ_showButtons: true,});
                return false;
            }
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            //获取file的全部id
            /*var uplist = $("input[id^=addUp1]");
            var arrId = [];
            var fileNames = [];//用于判断是否有重名文件
            for (var i = 0; i < uplist.length; i++) {
                if (uplist[i].value) {
                    arrId[i] = uplist[i].id;
                    if ($.inArray(uplist[i].value, fileNames) >= 0) {
                        $.ligerDialog.SQalert({content: "上传文件(" + uplist[i].value + ")文件重名！", SQ_type: "warning"});
                        return;
                    }
                    fileNames[i] = uplist[i].value;
                }
            }*/
            if (!insPlcBscInfoId) {//新增
                /*if($.inArray('addUp10_1',arrId)==-1){
                    $.ligerDialog.SQalert({content: "请上传商业险电子保单！", SQ_type: "warning"});
                    return false;
                }
                if($.inArray('addUp10_2',arrId)==-1&&isTrailer!="1"){
                    $.ligerDialog.SQalert({content: "请上传交强险电子保单！", SQ_type: "warning"});
                    return false;
                }*/
                var fileParams = upload_result_params;
                if (fileParams.length < 2) {
                    $.ligerDialog.SQalert({content: "请上传(商业险+交强险)电子保单！", SQ_type: "warning"});
                    return false;
                }
				/*if (arrId.length < 2) {
				 $.ligerDialog.SQalert({content: "请上传(商业险+交强险)电子保单！", SQ_type: "warning"});
				 return false;
				 }*/
            } else {//修改
                /*var tmp = 0;
                if (fileGrid.getData()) {
                    tmp = fileGrid.getData().length;
                }
                if(isTrailer!="1"){//非挂车 上传商业险+交强险
                    if (arrId.length + tmp < 2) {
                        $.ligerDialog.SQalert({content: "请上传(商业险+交强险)电子保单", SQ_type: "warning"});
                        return false;
                    }
                }else{//挂车 上传商业险
                    if (arrId.length + tmp < 1) {
                        $.ligerDialog.SQalert({content: "请上传商业险电子保单", SQ_type: "warning"});
                        return false;
                    }
                }*/
                var fileParams = upload_result_params;
                if(isTrailer!="1"){//非挂车 上传商业险+交强险
                    if (fileParams.length < 2) {
                        $.ligerDialog.SQalert({content: "请上传(商业险+交强险)电子保单", SQ_type: "warning"});
                        return false;
                    }
                }else{//挂车 上传商业险
                    if (fileParams.length < 1) {
                        $.ligerDialog.SQalert({content: "请上传商业险电子保单", SQ_type: "warning"});
                        return false;
                    }
                }
            }

            $.ligerDialog.hide();
            var _url = '<%=path%>/insurance/insPlcAppr/add.do?id=' + insPlcBscInfoId;
            if ($("#insCompSubId").is(":hidden")) {
                data["insCompSubNm"] = $("#insCompSubNm").val();
                data["insCompSubId"] = "0";//0用来删除原来的ID
            } else {
                data["insCompSubNm"] = $("#insCompSubId").val();
            }

            //保单起始时间
            data["plcBgTm"] = $("#plcBgTm").val();
            data["plcEndTm"] = $("#plcEndTm").val();
            //保存文件及保单
            // saveFileAndPlc(arrId, data, _url);
            saveFileAndPlc(upload_result_params_new, data, _url);
        });

       /* CreatUploadInputBox({
            target: "#addUp10_1",
            onBeforeRender: function (upfileBox) {
                upfileBox.prepend('<span class="UpfileCount">1</span>');
                upfileBox.find(".filenameBox").css("width", "150px");
            },
            placeholder: "请选择商业险电子保单",  //默认是“请选择文件”
            finishClear: true,
        });
        CreatUploadInputBox({
            target: "#addUp10_2",
            onBeforeRender: function (upfileBox) {
                upfileBox.prepend('<span class="UpfileCount">2</span>');
                upfileBox.find(".filenameBox").css("width", "150px");
            },
            placeholder: "请选择交强险电子保单",  //默认是“请选择文件”
            finishClear: true,
        });*/

        /*var FileCount = 2;
        $("#add_upfileBox").click(function (event) {
            $Html = CreatUploadInputBox({
                id: "addUp10_" + FileCount,  //id不跟着序号走！
                clearLine: true,
                deletable: true,
                finishClear: true,
                onDelete: function (upfileBox) {
                    setUpfileCount(); //删除的时候重新设置序号
                },
                onChange: function (e) {
                    $(e.target).remove_afterUploadIcon();
                }
            });
            $Html.find(".filenameBox").css("width", "150px");
            $Html.prepend('<span class="UpfileCount"></span>');
            $Html.appendTo($(this).siblings('.upfileBoxs'));
            setUpfileCount(); //新增组件后，设置序号
            FileCount++;
            SetIframe_height();
        });*/

    });

   /* function setUpfileCount() { //设置序号
        $(".UpfileCount").each(function (index, el) {
            $(this).html(index + 1);
        });
    }*/

    //保单资料Grid
    insFileInfoCfgGrid = $("#insFileInfoCfgGrid").ligerGrid({
        url: '<%=path%>/project/prjFileCfgInfo/initInsPlcFileInfoList.do?isShowSts=1&plcId=${insPlcBscInfoVO.id}&prjId=${prjId}',
        method: 'get',
        async:false,
        columns: [
            {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
            {display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                render:function(rowdata,rowindex,value){
                    if(value){
                        var h;
                        h='<a href="javascript:uploadFileByUrl(';
                        h+="'"+rowdata.filePath+"'";
                        h+=",'"+rowdata.fileNm+"'";
                        h+=')">'+rowdata.fileNm+'</a>'
                        return h;
                    }
                }
            },
            {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
            {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
            {display: '操作', name: 'option', minWidth: 100,align: 'left', enabledSort: false,
                render:function(rowdata,rowindex,value){
                    var h='';
                    if(ctrlKey==1){
                        if (rowdata.fileNm) {
                            if(rowdata.fileId) {
                                <sys:FlowFrmAth preTaskIds="${preTaskIds}" athCd="addPrjFile" pInstId="${pInstId}">
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ',' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                </sys:FlowFrmAth>
                            }else{
                                <sys:FlowFrmAth preTaskIds="${preTaskIds}" athCd="addPrjFile" pInstId="${pInstId}">
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                </sys:FlowFrmAth>
                            }
                        }
                    }else if(ctrlKey==2){
                        if(rowdata.filePath) {
                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                        }
                    }
                    return h;
                }
            },
            {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                render:function(rowdata,rowindex,value){
                    var h='';
                    if(ctrlKey==1){
                        <sys:FlowFrmAth preTaskIds="${preTaskIds}" athCd="addPrjFile" pInstId="${pInstId}">
                        h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                            ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowindex+'\',\''+rowdata.__id+'\')"></span>';
                        </sys:FlowFrmAth>
                    }
                    return h;
                }
            },
        ],
        root: 'rows',
        hideLoadButton : true,
        width: '100%',
        height: '100%',
        isScroll: false,
        rownumbers:true,  //显示序号
        checkbox: false,
        allowUnSelectRow:true,
        alternatingRow: false,
        frozen: false,
        usePager: false,
        onAfterShowData: function (){
            $('#insFileInfoCfgGrid').rowspan('datNm');
            // $('#insFileInfoCfgGrid').rowspan('uploadNm');
        },
    });
    //grid加载完毕初始所有上传数据
    var rows = insFileInfoCfgGrid.currentData.rows;
    for (var i = 0; i < rows.length ; i++) {
        if (rows[i].fileNm) {
            upload_result_params.push(rows[i])
        }
    }

    /**
     * 上传文件
     * @param e
     * @param cfgCd
     * @param cfgDtlCd
     * @param orgCd
     */
    function onChangefile_multi(e, cfgCd, cfgDtlCd, orgCd, rowIndex, rowID) {
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        var _filePath = $("#filePath").val();

        $.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
            secureuri: false,
            fileElementId: e.target.id,
            dataType: 'json',
            data: {filePath: _filePath},
            success: function (msg) {
                if (msg.success == 1) {
                    var files = msg.data;
                    var uplist = upload_result_params;
                    for (var i = 0; i < files.length; i++) {
                        //校验文件重名
                        for (var j = 0; j < uplist.length; j++) {
                            if (uplist[j].fileNm == files[i].fileNm) {
                                $.ligerDialog.SQalert({content: "上传文件(" + files[i].fileNm + ")文件重名！", SQ_type: "warning"});
                                wait_dialog.close();
                                return;
                            }
                        }
                        //点击上传的那一行数据
                        var activeRowData = insFileInfoCfgGrid.getRow(rowID);
                        //新增一行 参数：增加行的数据      点击行（那一行下增加）
                        var addDate = {filePath:files[i].filePath ,fileNm:files[i].fileNm,
                            datNm: activeRowData.datNm, crtTm:new Date(), option:activeRowData.option,
                            audStsCd:activeRowData.audStsCd, audStsCdNm:activeRowData.audStsCdNm,
                            cfgCd:activeRowData.cfgCd, cfgDtlCd:activeRowData.cfgDtlCd};
                        //上一条数据不为空 新增 为空修改
                        if (upload_result_params.length > 0 && null != activeRowData.filePath) {
                            insFileInfoCfgGrid.addRow(addDate, activeRowData);
                        } else {
                            insFileInfoCfgGrid.updateRow(rowID, addDate);
                            // insFileInfoCfgGrid.updateCell("filePath",files[i].filePath,rowIndex);
                            // insFileInfoCfgGrid.updateCell("fileNm",files[i].fileNm,rowIndex);
                            // insFileInfoCfgGrid.updateCell("cfgDtlCd",cfgDtlCd,rowIndex);
                            // insFileInfoCfgGrid.updateCell("cfgCd",cfgCd,rowIndex);
                            // insFileInfoCfgGrid.updateCell("crtTm",new Date(),rowIndex);
                            // insFileInfoCfgGrid.deleteRow(rowIndex);//删除行
                        }
                        files[i].cfgCd = cfgCd ;
                        files[i].cfgDtlCd = cfgDtlCd;
                        files[i].orgCd = orgCd;
                        upload_result_params.push(files[i]);
                        upload_result_params_new.push(files[i]);
                    }
                    wait_dialog.close();
                    // upload_result_params = upload_result_params.concat(files);
                } else {
                    wait_dialog.close();
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    };


    function uploadFileByUrl(_url,_name){
        if(serverPrefixPath.length >1 && serverPrefixPath.indexOf("\"")>=0){
            serverPrefixPath = serverPrefixPath.substring(1,serverPrefixPath.length-1);
        }
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            //SQ.imgPreview(_url, true);
            window.__ImgSrc = serverPrefixPath + _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(serverPrefixPath + _url);
        }
    }

    function downloadInsFileByUrl() {
        var data = insFileInfoCfgGrid.getData();
        //var files = [];
        var ids = [];
        for (var i = 0; i < data.length; i++) {
            var map = {};
            /* if(data[i].filePath){
                map.name = data[i].fileNm;
                map.path = data[i].filePath.substring(data[i].filePath.indexOf("attachments"));
                files.push(map);
            } */
            if(StringUtils.isNotEmpty(data[i].fileId)){
                ids.push(data[i].fileId);
            }
        }
        var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
        var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }

    //修改资料的验证状态
    function modifyAudStsCd(event,_fileId,_audStsCd){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/project/prjFileInfo/modifyFileAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    //$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //删除文件
    function delFile(event,_fileId,rowIndex,cfgDtlCd){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {'fileId':_fileId},
                    url: '<%=path%>/project/prjFileInfo/removeFile.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            event.stopPropagation();
                            // clearUploadResultParams();//清除上传结果参数
                            for (var i=0; i< upload_result_params.length; i++){
                                if(upload_result_params[i].cfgDtlCd == cfgDtlCd){
                                    upload_result_params.splice(i,1);
                                    break;
                                }
                            }
                            var addDate = {filePath:null ,fileNm:null, crtTm:null};
                            insFileInfoCfgGrid.updateRow(rowIndex, addDate);
                            insFileInfoCfgGrid.reload();
                        }else{
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            }
        });
    }

    //删除文件
    function delUpLoadindFile(event,rowIndex,cfgDtlCd){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                for (var i=0; i< upload_result_params.length; i++){
                    if(upload_result_params[i].cfgDtlCd == cfgDtlCd){
                        upload_result_params.splice(i,1);
                        break;
                    }
                }
                var addDate = {filePath:null ,fileNm:null, crtTm:null};
                insFileInfoCfgGrid.updateRow(rowIndex, addDate);
                // insFileInfoCfgGrid.updateCell("filePath",null,rowIndex);
                // insFileInfoCfgGrid.updateCell("fileNm",null,rowIndex);
                // insFileInfoCfgGrid.updateCell("crtTm",null,rowIndex);
                wait_dialog.close();
            }
        });
    }

    //保存文件及保单
    function saveFileAndPlc(fileParams, data, _url) {
        // function saveFileAndPlc(arrId, data, _url) {
        //     if (fileParams.length > 0) {
        // var _filePath = $("#filePath").val();
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        /*$.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
                secureuri: false,
                fileElementId: arrId,  //这里不在是以前的id了，要写成数组的形式！
                dataType: 'json',
                data: {filePath: _filePath},
                success: function (msg) {
                    if (msg.success == 1) {
                        data["fileParams"] = JSON.stringify(msg.data);*/

        data["fileParams"] = JSON.stringify(fileParams);
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: data,
            url: _url,
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    if (!insPlcBscInfoId) {
                        insPlcBscInfoId = msg.data;
                    }
                    /*   refreshUlFileRecListByPkId(insPlcBscInfoId,"INS_PLC_BSC_INFO");
                       $("#fileModify").show();*/

                    // if (plcId) {
                    //     return;
                    // }
                    // //回调刷新列表
                    // var callback = GET_W2Wcallback();
                    // if(callback){
                    //     callback();
                    // }
                    window.location.reload();
                    // Remove_navTab();
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
        /* } else {
             wait_dialog.close();
             $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
         }
     },
 });*/
        /*} else {
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        if (!insPlcBscInfoId) {
                            insPlcBscInfoId = msg.data;
                        }
                        if (plcId) {
                            return;
                        }

                        //回调刷新列表
                        var callback = GET_W2Wcallback();
                        if(callback){
                            callback();
                        }

                        Remove_navTab();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        }*/
    }

    //查询城市
    function setCity(value) {
        var rgnCd = liger.get("rgnPrCd").getValue();
        if (!rgnCd) {
            return;
        }
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {rgnCd: rgnCd},
            url: '<%=path%>/system/sysRegion/getRegionByRgnCd.do',
            success: function (msg) {
                if (msg.success == 1) {
                    liger.get("rgnCyCd").setData("", true);
                    if (msg.data) {
                        liger.get("rgnCyCd").setData(msg.data, true);
                        liger.get("rgnCyCd").updateStyle();
                    }
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //查询保险支公司
    function setInsSubComp() {
        if ($("#insCompSubId").is(":hidden")) {
            return;
        }
        var compId = liger.get("insCompId").getValue();
        if (!compId) {
            return;
        }
        var rgnPrCd = liger.get("rgnPrCd").getValue();
        if (!rgnPrCd) {
            return;
        }
        var rgnCyCd = liger.get("rgnCyCd").getValue();
        if (!rgnCyCd) {
            return;
        }
        var buyWayCd = liger.get("buyWayCd").getValue();
        if (!buyWayCd) {
            return;
        }
        var subComp = liger.get("insCompSubId");
        var paySchNo = $("#paySchNo").val();
        var prjPrdDtlId = $("#prjPrdDtlId").val();
        var plcSpePolCd = $("#plcSpePolCd").val();
        var insTypCd = liger.get("insTypCd").getValue();
        if (!insTypCd) {
            return;
        }
        var prdTypCd = liger.get("prdTypCd").getValue();
        if (!prdTypCd) {
            return;
        }
		/*if(buyWayCd!=1){
		 subComp.setData([],true);
		 subComp.setText("");
		 return;
		 }*/
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {
                'insCompId': compId,
                'rgnPrCd': rgnPrCd,
                'rgnCyCd': rgnCyCd,
                'buyWayCd': buyWayCd,
                'paySchNo': paySchNo,
                'prjPrdDtlId': prjPrdDtlId,
                'plcSpePolCd': plcSpePolCd,
                'insTypCd': insTypCd,
                'prdTypCd': prdTypCd
            },
            url: '<%=path%>/insurance/insCompInfo/selectInsSubComp.do',
            success: function (msg) {
                if (msg.success == 1) {
                    if (msg.data && msg.data.subCompList) {
                        subComp.setData(msg.data.subCompList, true);
                    } else {
                        subComp.setData([], true);
                        subComp.setText("");
                    }
                    if (msg.data && msg.data.chnPol) {
                        $('#chnPol').val(msg.data.chnPol);
                    }
                    subComp.updateStyle();
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error", SQ_showButtons: true,});
                }
            }
        });
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    //验证保单号是否重复
    function validatePlcNo(_val) {
        if (!_val || _val=="${insPlcApprVo.plcNo}") {
            return;
        }
        $.ajax({
            type: 'get',
            url: '<%=path%>/insurance/insPlcBscInfo/validatePlcNo.do?plcNo=' + _val,
            dataType: 'json',
            async:false,
            success: function (msg) {
                if (msg.success == 1) {
                    if (msg.data && msg.data.isSingle == 'false') {
                    	if (paySchNo != msg.data.paySchNo) {
                            checkPlcNoStr = "保单号：" + _val + "与{" + msg.data.paySchNo + "}重复，请确认";
                            $.ligerDialog.SQalert({content: checkPlcNoStr, SQ_type: "warning", SQ_showButtons: true,});
                            $("#saveInsPlcBscInfo_Btn").attr("validateplcno", "fail");
                        }
                    } else {
                        $("#saveInsPlcBscInfo_Btn").removeAttr("validateplcno");
                    }
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //验证保险公司是否可用
    function validateInsComp(_val) {
        var _insCompId = liger.get('insCompSubId').getValue();
        if (!_insCompId) {
            return;
        }
        var buyWayCd = liger.get("buyWayCd").getValue();
        if (buyWayCd != 1) {
            return;
        }
        var _prdTypCd = liger.get('prdTypCd').getValue();
        var _prdTypCdNm = liger.get('prdTypCd').getText();
        var _insTypCd = liger.get('insTypCd').getValue();
        if (!_prdTypCd) {
            $.ligerDialog.SQalert({content: "请先选择保单产品类型", SQ_type: "warning"});
            liger.get('insCompSubId').setValue('');
            return;
        }
        $.ajax({
            type: 'get',
            url: '<%=path%>/insurance/insPlcBscInfo/validateInsComp.do?insCompId=' + _insCompId + '&prdTypCd=' + _prdTypCd + '&insTypCd=' + _insTypCd,
            dataType: 'json',
            success: function (msg) {
                if (msg.success == 1) {
                    if (msg.data && msg.data.available == 'true') {
                        $.ligerDialog.SQalert({
                            content: "此【" + _val + "】保险支公司，产品类型（" + _prdTypCdNm + "）未录入返利比例，请联系保险部！",
                            SQ_type: "warning",
                            SQ_showButtons: true,
                        });
                        $("#saveInsPlcBscInfo_Btn").attr("validateinscomp", "fail");
                    } else {
                        $("#saveInsPlcBscInfo_Btn").removeAttr("validateinscomp");
                        if (msg.data && msg.data.chnPol) {
                            $('#chnPol').val(msg.data.chnPol);
                        }
                    }
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //合格证详情
    function detailBtn(id, dtlId) {
        var detailFlag = true;
        Add_navTab('tab_prj_prd_veh_info_detail' + id, '合格证详情', '<%=path%>/project/prjprdvehinfo/toAddPage.do?detailFlag=' + detailFlag + '&&id=' + id + '&&dtlId=' + dtlId);
    }
    //是否不计免赔
    function changeCheckbox(event, rowData) {
        rowData.isNonDedu = $(event.target).prop('checked');
    }
    //查询保险特殊政策，是否渠道放开
    function changeInsSubComp() {
        var buyWayCd = liger.get("buyWayCd").getValue();
        if (buyWayCd == '' || buyWayCd == 1) {
            return;
        }
        var plcTypCd = liger.get("plcPropCd").getValue();
        if (!plcTypCd) {
            return;
        }
        var insTypCd = liger.get("insTypCd").getValue();
        if (!insTypCd) {
            return;
        }
        var prjTypCd = $("#prjTypCd").val();
        var bizTypCd = $("#bizTypCd").val();
		/*var rgnCd=$("#rgnCd").val();*/
        var orgCd = $("#orgCd").val();
        $.ajax({
            type: 'post',
            url: '<%=path%>/insurance/insPlcBscInfo/getInsSubCompType.do',
            dataType: 'json',
            data: {
                'plcTypCd': plcTypCd,
                'insTypCd': insTypCd,
                'prjTypCd': prjTypCd,
                'bizTypCd': bizTypCd,
                'orgCd': orgCd
            },
            success: function (msg) {
                if (msg.success == 1) {
                    if (msg.data) {
                        $("#plcSpePolCd").val(msg.data);
                        form.setFieldValidate("insCompSubId", {required: false});
                        form.setFieldValidate("insCompSubNm", {required: true, maxlength: 200});
                        form.setFieldValidate("plcNo", {required: false, maxlength: 30});
                        form.setFieldValidate("rgnPrCd", {required: false});
                        form.setFieldValidate("rgnCyCd", {required: false});
                        $("#subNmDiv").show();
                        $("#subIdDiv").hide();
                        $(".insplc").hide();
                    } else {
                        $("#plcSpePolCd").val("");
                        form.setFieldValidate("insCompSubId", {required: true});
                        form.setFieldValidate("insCompSubNm", {required: false, maxlength: 200});
                        form.setFieldValidate("plcNo", {required: true, maxlength: 30});
                        form.setFieldValidate("rgnPrCd", {required: true});
                        form.setFieldValidate("rgnCyCd", {required: true});
                        $("#subNmDiv").hide();
                        $("#subIdDiv").show();
                        $(".insplc").show();
                        setInsSubComp();
                    }
                }
            }
        });
    }

</script>
</body>
</html>
